var e = require("../../../../../@babel/runtime/helpers/objectSpread2");
Component({
  properties: {
    content: {
      type: Object,
      value: {}
    },
    issalesman: {
      type: Number,
      value: 0
    }
  },
  data: {
    markers: [{
      iconPath: "https://statics.zhaogongdi.com/images/wp/location.png",
      latitude: "",
      longitude: "",
      id: 1,
      width: 40,
      height: 40
    }]
  },
  methods: {
    onCall: function (data) {
      var phone = data.currentTarget.dataset.phone
      console.log(phone)
      if (this.data.issalesman == 1 && phone) {
        wx.makePhoneCall({
          phoneNumber: phone,
        })
      } else {
        wx.makePhoneCall({
          phoneNumber: phone,
        })
      }
    },
    onClickMap: function () {
      var t = this.data,
        a = t.latitude,
        i = t.longitude,
        n = t.address;
      if (i || a) {
        var o = {
          latitude: parseFloat(a),
          longitude: parseFloat(i),
          name: n,
          address: n,
          scale: 18
        };
        wx.openLocation(e({}, o))
      }
    }
  },
  observers: {
    content: function (t) {
      if (t) {

        var a = t.address,
          i = t.area,
          n = t.sold_price,
          o = t.rent_price,
          r = t.latitude,
          s = t.longitude,
          l = t.class.map((function (e) {
            return e.name
          })).join(" "),
          d = a || i,
          u = (null == n ? void 0 : n.value) || (null == o ? void 0 : o.value) || "",
          c = 0 != Number(s) && 0 != Number(r);
        this.setData(e(e({}, t), {}, {
          classText: l,
          addressText: d,
          priceText: u,
          longitude: s || "",
          latitude: r || "",
          showMap: c,
          "markers[0].latitude": r,
          "markers[0].longitude": s
        }))
      }
    }
  }
});